/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package firstround2009;

import java.io.IOException;
import java.util.Vector;
import static chanlib.Chan_IO.*;

/**
 * Finished at 2:15:42
 * @author robit
 */
public class CenterOfMass{
    /*
      All neccesary to be defined
      including:
      variable, inner class
    */
    // static int A;
    // static void B();
    // static class C

    /*
       One calculation fits all of the cases.
    */
    static void preReckon(){
        return;
    }

    /*
      calculate the answer
    */
    private static void reckon(int line) {
        int N=Int();
        //double s[][]=new double[N][3],v[][]=new double[N][3];
        double s[]={.0,.0,.0},v[]={.0,.0,.0};
        for(int i=0;i<N;i++){
            s[0]+=Double();
            s[1]+=Double();
            s[2]+=Double();
            v[0]+=Double();
            v[1]+=Double();
            v[2]+=Double();
           //print(format("%f %f %f %f %f %f",Double(),Double(),Double(),Double(),Double(),Double()));
           //println("");
        }
        s[0]/=N;s[1]/=N;s[2]/=N;
        v[0]/=N;v[1]/=N;v[2]/=N;
        double tmin=-(s[0]*v[0]+s[1]*v[1]+s[2]*v[2])/(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]);
        double smin[]={ s[0]+v[0]*tmin,s[1]+v[1]*tmin,s[2]+v[2]*tmin};
        if(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]==0){
            tmin=0;
            smin=s;
        }else if(tmin<0){
            tmin=0;
            smin=s;
        }
        if(tmin==0)tmin=0;
        
        double dmin=Math.sqrt(smin[0]*smin[0]+smin[1]*smin[1]+smin[2]*smin[2]);
        //print(v[0]);print(v[1]);print(v[2]);
        String output=String.format("Case #%d: %.8f %.8f", line,dmin,tmin);
        writeln(output, OUTFILE);
        //writeln(String.format("N=%d K=%d\n%s", N, K, ans),ANALFILE);
        //println(output);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        /*
           Pre-computing for all cases
        */

        // Just in case!
        //preReckon();
        //while((char)read()!='P');

        /*
          Input-output
        */
        boolean test=false;
        boolean small=false;
        String prob="B";
        String filename;
        if(test) filename="test";
        else{
            if(small) filename=prob+"-small-practice";
            else filename=prob+"-large-practice";
        }
        try {
            /*
               Init IO,plus determination of input line number
             */
            int lineNums = initFileIO(filename);
            for (int i = 1; i <= lineNums; i++) {
                reckon(i);
            }
        } finally {
            endIO();
        }
    }

}